var singleNumber = function(nums) {
    let hasObj = new Set()
    for (item of nums) {
        if (hasObj.has(item)) {
            hasObj.delete(item)
        } else {
            hasObj.add(item)
        }
    }
    let a
    hasObj.forEach(function(item) {
        a = item
    });
    return a
};
let nums = [1, 1, 2, 2, 3, 3, 4]
// let a = singleNumber(nums)

console.log(nums.sort())
